home *** CD-ROM | disk | FTP | other *** search
/ Aminet 3 / Aminet 3 - July 1994.iso / Aminet / mus / misc / The_Player_6_0A.lha / Player6.0A / Source / 600.2_devpac2.asm next >
Assembly Source File  |  1994-01-22  |  37KB  |  2,424 lines

  1. * The Player 6.0A for DevPac 2 and later *
  2. * Tested with Devpac 2.15
  3.  
  4. ;start = 6    ;Starting position
  5.  
  6. fade  = 0    ;0 = normal
  7.         ;1 = use master volume
  8.  
  9. system = 1    ;0 = killer
  10.         ;1 = friendly
  11.  
  12. CIA = system!1    ;0 = disabled
  13.         ;1 = enabled
  14.         ;System friendly version always CIA
  15.  
  16. exec = 1    ;0 = ExecBase destroyed
  17.         ;1 = ExecBase valid
  18.  
  19. lev6 = 1    ;0 = NonLev6
  20.         ;1 = Lev6 used
  21.  
  22.  
  23. channels = 4    ;amount of channels to be played
  24.  
  25. use = -1    ;The Usecode
  26.  
  27.     incdir    include:
  28.     include Player6.i
  29.  
  30.     section    Player6.0A,code
  31.  
  32.     movem.l    d0-a6,-(sp)
  33.     lea    $dff000,a6
  34.     ifeq    system
  35.     move    $1c(a6),-(sp)
  36.     move    #$7fff,$9a(a6)
  37.     move    #$e000,$9a(a6)
  38.     move    2(a6),-(sp)
  39.     move    #$7ff,$96(a6)
  40.     endc
  41.  
  42.     lea    P60_data,a0    ;Module
  43.     sub.l    a1,a1        ;Samples
  44.     lea    samples,a2    ;Sample buffer
  45.     moveq    #0,d0        ;Auto Detect
  46.     bsr    P60_motuuli+P60_InitOffset
  47.  
  48.     tst    d0        ;Went ok?
  49.     bne    P60_exit
  50.  
  51. P60_sync
  52.     ifeq    CIA
  53.     move.l    4(a6),d0
  54.     andi.l    #$1ff00,d0
  55.     cmp.l    #$8100,d0
  56.     bne.b    P60_sync
  57.  
  58. P60_sync2
  59.     move.l    4(a6),d0
  60.     andi.l    #$1ff00,d0
  61.     cmp.l    #$8200,d0
  62.     bne.b    P60_sync2
  63.  
  64.     move    #$fff,$180(a6)
  65.     bsr    P60_motuuli+P60_MusicOffset
  66.     clr    $180(a6)
  67.  
  68.     moveq    #0,d0
  69.     move    6(a6),d0
  70.     sub.l    #$8200,d0
  71.     cmp.l    P60_raster(pc),d0
  72.     ble.b    P60_kosj
  73.     move    d0,P60_raster+2
  74. P60_kosj
  75.     tst    P60_raster2+2
  76.     bne.b    P60_doing
  77.     move    d0,P60_raster2+2
  78.     bra.b    P60_doneg
  79. P60_doing
  80.     add.l    P60_raster2(pc),d0
  81.     asr.l    #1,d0
  82.     move.l    d0,P60_raster2
  83. P60_doneg
  84.     addq.l    #1,P60_frames
  85.  
  86.     ifne    fade
  87.     btst    #10,$16(a6)
  88.     bne.b    P60_jid
  89.     move    P60_diri(pc),d0
  90.     sub    d0,P60_motuuli+P60_MasterVolume
  91.     bne.b    P60_judo
  92.     neg    P60_diri
  93.     bra.b    P60_jid
  94. P60_judo
  95.     cmp    #64,P60_motuuli+P60_MasterVolume
  96.     bne.b    P60_jid
  97.     neg    P60_diri
  98.     endc
  99.  
  100. P60_jid
  101.     endc
  102.  
  103.     btst    #6,$bfe001
  104.     bne    P60_sync
  105.  
  106. P60_exit
  107.     bsr    P60_motuuli+P60_EndOffset
  108.  
  109.     ifeq    system
  110.     move    (sp)+,d7
  111.     bset    #15,d7
  112.     move    #$7ff,$96(a6)
  113.     move    d7,$96(a6)
  114.  
  115.     move    (sp)+,d7
  116.     bset    #15,d7
  117.     move    #$7fff,$9a(a6)
  118.     move    d7,$9a(a6)
  119.     endc
  120.     movem.l    (sp)+,d0-a6
  121.  
  122.     move.l    P60_raster(pc),d0
  123.     move.l    P60_raster2(pc),d1
  124.     move.l    P60_frames(pc),d2
  125.     move.l    P60_positionbase(pc),a0
  126.     move.l    P60_patternbase(pc),a1
  127.     move.l    P60_spos(pc),a2
  128.     rts
  129.  
  130. P60_IRQsave    dc    0
  131. P60_DMAsave    dc    0
  132. P60_raster    dc.l    0
  133. P60_raster2    dc.l    0
  134. P60_frames    dc.l    0
  135. P60_diri    dc    1
  136.  
  137. *********************************
  138. *        Player 6.0A ®        *
  139. *   All in one-DevPac2-version     *
  140. *        Version 600.2        *
  141. *   © 1992-93 Jarno Paananen    *
  142. *     All rights reserved    *
  143. *********************************
  144.  
  145.  
  146. ******** START OF BINARY FILE **************
  147.  
  148. P60_motuuli
  149.     bra    P60_Init
  150.     ifeq    CIA
  151.     bra    P60_Music
  152.     endc
  153.     ifne    CIA
  154.     rts
  155.     rts
  156.     endc
  157.     bra    P60_End
  158.     rts                ;no P60_SetRepeat
  159.     rts
  160.  
  161. P60_master    dc    64        ;Master volume (0-64)
  162. P60_Tempo    dc    1        ;Use tempo? 0=no,non-zero=yes
  163. P60_play    dc    1        ;Stop flag (0=stop)
  164. P60_E8        dc    0        ;Info nybble after command E8
  165.  
  166. P60_Temp0Offset
  167.     dc.l    P60_temp0-P60_motuuli
  168. P60_Temp1Offset
  169.     dc.l    P60_temp1-P60_motuuli
  170. P60_Temp2Offset
  171.     dc.l    P60_temp2-P60_motuuli
  172. P60_Temp3Offset
  173.     dc.l    P60_temp3-P60_motuuli
  174.  
  175. P60_getnote    macro
  176.     moveq    #$7e,d0
  177.     and.b    (a5),d0
  178.     beq.b    .nonote
  179.     ifne    P60_vib
  180.     clr.b    P60_VibPos(a5)
  181.     endc
  182.     ifne    P60_tre
  183.     clr.b    P60_TrePos(a5)
  184.     endc
  185.  
  186.     ifne    P60_ft
  187.     add    P60_Fine(a5),d0
  188.     endc
  189.     move    d0,P60_Note(a5)
  190.     move    (a2,d0),P60_Period(a5)
  191.  
  192. .nonote
  193.     endm
  194.  
  195.     ifne    CIA
  196.  
  197.     ifeq    system
  198. P60_intti
  199.     movem.l    d0-a6,-(sp)
  200.     tst.b    $bfdd00
  201.     move.b    #$7e,$bfdd00
  202.  
  203.     lea    $dff000,a6
  204. ;    move    #$fff,$180(a6)
  205.     bsr    P60_Music
  206. ;    move    #0,$180(a6)
  207.     move    #$2000,$9c(a6)
  208.     movem.l    (sp)+,d0-a6
  209.     rte
  210.  
  211.     endc    
  212.  
  213.     ifne    system
  214. P60_lev6server
  215.     movem.l    d2-d7/a2-a6,-(sp)
  216.     lea    $dff000,a6
  217.     lea    P60_cn(pc),a3
  218.     move    P60_server(pc),d0
  219.     beq.b    P60_musica
  220.     subq    #1,d0
  221.     beq    P60_dmason
  222.     bra    P60_setrepeat
  223. P60_musica
  224.     bsr    P60_Music
  225. P60_ohi    movem.l    (sp)+,d2-d7/a2-a6
  226.     moveq    #1,d0
  227.     rts
  228.     endc
  229.     endc
  230.  
  231. ;­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­
  232. ;­ Call P60_Init to initialize the playroutine    ­
  233. ;­ D0 --> Timer detection (for CIA-version)    ­
  234. ;­ A0 --> Address to the module            ­
  235. ;­ A1 --> Address to samples/0            ­
  236. ;­ A2 --> Address to sample buffer        ­
  237. ;­ D0 <-- 0 if succeeded            ­
  238. ;­ A6 <-- $DFF000                ­
  239. ;­         Uses D0-A6            ­
  240. ;­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­
  241.  
  242. P60_Init
  243.     cmp.l    #"P60A",(a0)+
  244.     beq.b    .modok
  245.     subq.l    #4,a0
  246.  
  247. .modok    
  248.     ifne    CIA
  249.     move    d0,-(sp)
  250.     endc
  251.  
  252.     moveq    #0,d0
  253.     cmp.l    d0,a1
  254.     bne.b    .redirect
  255.  
  256.     move    (a0),d0
  257.     lea    (a0,d0.l),a1
  258. .redirect
  259.     move.l    a2,a6
  260.     lea    8(a0),a2
  261.     moveq    #$40,d0
  262.     and.b    3(a0),d0
  263.     bne.b    .buffer
  264.     move.l    a1,a6
  265.     subq.l    #4,a2
  266. .buffer
  267.  
  268.     lea    P60_cn(pc),a3
  269.     moveq    #$1f,d1
  270.     and.b    3(a0),d1
  271.     move.l    a0,-(sp)
  272.     lea    P60_Samples(pc),a4
  273.     subq    #1,d1
  274.     moveq    #0,d4
  275. P60_lopos
  276.     move.l    a6,(a4)+
  277.     move    (a2)+,d4
  278.     bpl.b    P60_kook
  279.     neg    d4
  280.     lea    P60_Samples-16(pc),a5
  281.  
  282.     asl    #4,d4
  283.     move.l    (a5,d4),d6
  284.  
  285.     move.l    d6,-4(a4)
  286.     move    4(a5,d4),d4
  287.     sub.l    d4,a6
  288.     sub.l    d4,a6
  289.     bra.b    P60_jatk
  290.  
  291. P60_kook
  292.     move.l    a6,d6
  293.     tst.b    3(a0)
  294.     bpl.b    P60_jatk
  295.  
  296.     move.l    d4,d0
  297.     subq.l    #2,d0
  298.     bmi.b    P60_jatk
  299.     move.l    a6,a5
  300.     move.b    (a5)+,d2
  301.     sub.b    (a5),d2
  302.     move.b    d2,(a5)+
  303. .loop    sub.b    (a5),d2
  304.     move.b    d2,(a5)+
  305.     sub.b    (a5),d2
  306.     move.b    d2,(a5)+
  307.     dbf    d0,.loop
  308.  
  309. P60_jatk
  310.     move    d4,(a4)+
  311.     moveq    #0,d2
  312.     move.b    (a2)+,d2
  313.     moveq    #0,d3
  314.     move.b    (a2)+,d3
  315.  
  316.     moveq    #0,d0
  317.     move    (a2)+,d0
  318.     bmi.b    .norepeat
  319.  
  320.     move    d4,d5
  321.     sub    d0,d5
  322.     move.l    d6,a5
  323.  
  324.     add.l    d0,a5
  325.     add.l    d0,a5
  326.  
  327.     move.l    a5,(a4)+
  328.     move    d5,(a4)+
  329.     bra.b    P60_gene
  330. .norepeat
  331.     move.l    d6,(a4)+
  332.     move    #1,(a4)+
  333. P60_gene
  334.     move    d3,(a4)+
  335.     moveq    #$f,d0
  336.     and    d2,d0
  337.     mulu    #74,d0
  338.     move    d0,(a4)+
  339.  
  340.     tst    -6(a2)
  341.     bmi.b    .nobuffer
  342.  
  343.     moveq    #$40,d0
  344.     and.b    3(a0),d0
  345.     beq.b    .nobuffer
  346.  
  347.     move    d4,d7
  348.     tst.b    d2
  349.     bpl.b    .copy
  350.  
  351.     subq    #1,d7
  352.     moveq    #0,d5
  353.     moveq    #0,d4
  354. .lo    move.b    (a1)+,d4
  355.     moveq    #$f,d3
  356.     and    d4,d3
  357.     lsr    #4,d4
  358.  
  359.     sub.b    .table(pc,d4),d5
  360.     move.b    d5,(a6)+
  361.     sub.b    .table(pc,d3),d5
  362.     move.b    d5,(a6)+
  363.     dbf    d7,.lo
  364.     bra.b    .kop
  365.  
  366. .copy    add    d7,d7
  367.     subq    #1,d7
  368. .cob    move.b    (a1)+,(a6)+
  369.     dbf    d7,.cob
  370.     bra.b    .kop
  371.  
  372. .table dc.b    0,1,2,4,8,16,32,64,128,-64,-32,-16,-8,-4,-2,-1
  373.  
  374. .nobuffer
  375.     add.l    d4,a6
  376.     add.l    d4,a6
  377. .kop    dbf    d1,P60_lopos
  378.  
  379.     move.l    (sp)+,a0
  380.     and.b    #$7f,3(a0)
  381.  
  382.     move.l    a2,-(sp)
  383.  
  384.     lea    P60_temp0(pc),a1
  385.     lea    P60_temp1(pc),a2
  386.     lea    P60_temp2(pc),a4
  387.     lea    P60_temp3(pc),a5
  388.     moveq    #Channel_Block_SIZE/2-2,d0
  389.  
  390.     moveq    #0,d1
  391. .cl    move    d1,(a1)+
  392.     move    d1,(a2)+
  393.     move    d1,(a4)+
  394.     move    d1,(a5)+
  395.     dbf    d0,.cl
  396.  
  397.     move.l    (sp)+,a2
  398.     move.l    a2,P60_positionbase-P60_cn(a3)
  399.  
  400.     moveq    #$7f,d1
  401.     and.b    2(a0),d1
  402.  
  403.     lsl    #3,d1
  404.     lea    (a2,d1.l),a4
  405.  
  406.     move.l    a4,P60_possibase-P60_cn(a3)
  407.  
  408.     move.l    a4,a1
  409.     moveq    #-1,d0
  410. .search    cmp.b    (a1)+,d0
  411.     bne.b    .search
  412.     move.l    a1,P60_patternbase-P60_cn(a3)    
  413.  
  414.     ifd    start
  415.     lea    start(a4),a4
  416.     endc
  417.  
  418.     moveq    #0,d0
  419.     move.b    (a4)+,d0
  420.     move.l    a4,P60_spos-P60_cn(a3)
  421.     lsl    #3,d0
  422.     add.l    d0,a2
  423.  
  424.     move.l    a1,a4
  425.     moveq    #0,d0    
  426.     move    (a2)+,d0
  427.     lea    (a4,d0.l),a1
  428.     move.l    a1,P60_ChaPos+P60_temp0-P60_cn(a3)
  429.     move    (a2)+,d0
  430.     lea    (a4,d0.l),a1
  431.     move.l    a1,P60_ChaPos+P60_temp1-P60_cn(a3)
  432.     move    (a2)+,d0
  433.     lea    (a4,d0.l),a1
  434.     move.l    a1,P60_ChaPos+P60_temp2-P60_cn(a3)
  435.     move    (a2)+,d0
  436.     lea    (a4,d0.l),a1
  437.     move.l    a1,P60_ChaPos+P60_temp3-P60_cn(a3)
  438.  
  439.     lea    P60_setrepeat(pc),a0
  440.     move.l    a0,P60_intaddr-P60_cn(a3)
  441.  
  442.     move    #63,P60_rowpos-P60_cn(a3)
  443.     move    #6,P60_speed-P60_cn(a3)
  444.     move    #5,P60_speed2-P60_cn(a3)
  445.     clr    P60_speedis1-P60_cn(a3)
  446.  
  447.     ifne    P60_pl
  448.     clr.l    P60_plcount-P60_cn(a3)
  449.     endc
  450.  
  451.     ifne    P60_pde
  452.     clr    P60_pdelay-P60_cn(a3)
  453.     endc
  454.     clr    (a3)
  455.  
  456.     moveq    #2,d0
  457.     and.b    $bfe001,d0
  458.     move.b    d0,P60_ofilter-P60_cn(a3)
  459.     bset    #1,$bfe001
  460.  
  461.     ifeq    system
  462.     ifne    exec
  463.     move.l    4.w,a6
  464.     moveq    #0,d0
  465.     btst    d0,297(a6)
  466.     beq.b    .no68010
  467.  
  468.     lea    P60_liko(pc),a5
  469.     jsr    -$1e(a6)
  470.  
  471. .no68010
  472.     move.l    d0,a0
  473.     lea    $78(a0),a0
  474.     endc
  475.     ifeq    exec
  476.     lea    $78.w,a0
  477.     endc
  478.  
  479.     move.l    a0,P60_vektori-P60_cn(a3)
  480.     move.l    (a0),P60_oldlev6-P60_cn(a3)
  481.     lea    P60_dmason(pc),a1
  482.     move.l    a1,(a0)
  483.     endc
  484.  
  485.     moveq    #0,d0
  486.     lea    $dff000,a6
  487.     move    d0,$a8(a6)
  488.     move    d0,$b8(a6)
  489.     move    d0,$c8(a6)
  490.     move    d0,$d8(a6)
  491.     move    #$f,$96(a6)
  492.  
  493.     ifeq    system
  494.     move    #$2000,$9a(a6)
  495.     lea    $bfd000,a0
  496.     move.b    #$7f,$d00(a0)
  497.     move.b    #8,$e00(a0)
  498.     endc
  499.  
  500.     ifeq    CIA
  501.     move.b    #$4a,$400(a0)
  502.     move.b    #1,$500(a0)
  503.     move.b    #$81,$d00(a0)
  504.     endc
  505.  
  506.     ifne    CIA
  507.     move    (sp)+,d0
  508.     subq    #1,d0
  509.     beq.b    P60_ForcePAL
  510.     subq    #1,d0
  511.     beq.b    P60_NTSC
  512.     ifne    exec
  513.     move.l    4.w,a1
  514.     cmp.b    #60,$212(a1)    ;VBlankFrequency
  515.     beq.b    P60_NTSC
  516.     endc
  517. P60_ForcePAL
  518.     move.l    #1773447,d0    ;PAL
  519.     bra.b    P60_setcia
  520. P60_NTSC
  521.     move.l    #1789773,d0    ;NTSC
  522. P60_setcia
  523.     move.l    d0,P60_timer-P60_cn(a3)
  524.     divu    #125,d0
  525.     move    d0,P60_thi2-P60_cn(a3)
  526.     sub    #$1c8*2,d0
  527.     move    d0,P60_thi-P60_cn(a3)
  528.  
  529.     ifeq    system
  530.     move.b    d0,$400(a0)
  531.     lsr    #8,d0
  532.     move.b    d0,$500(a0)
  533.  
  534.     lea    P60_intti(pc),a1
  535.     move.l    a1,P60_tintti-P60_cn(a3)
  536.     move.l    P60_vektori(pc),a2
  537.     move.l    a1,(a2)
  538.  
  539.     move.b    #$81,$d00(a0)
  540.     move.b    #$19,$e00(a0)
  541.     moveq    #0,d0
  542.     endc
  543.     endc
  544.  
  545.  
  546.     ifeq    system
  547.     move    #$e000,$9a(a6)
  548.     rts
  549.  
  550.     ifne    exec
  551. P60_liko
  552.     dc.l    $4E7A0801        ;MOVEC    VBR,d0
  553.     rte
  554.     endc
  555.     endc
  556.  
  557.     ifne    system
  558.     move.l    a6,-(sp)
  559.     clr    P60_server-P60_cn(a3)
  560.  
  561.     move.l    4.w,a6
  562.     moveq    #-1,d0
  563.     jsr    -$14a(a6)
  564.     move.b    d0,P60_sigbit-P60_cn(a3)
  565.     bmi    P60_err
  566.  
  567.     lea    P60_allocport(pc),a1
  568.     move.l    a1,P60_portti-P60_cn(a3)
  569.     move.b    d0,15(a1)
  570.     move.l    a1,-(sp)
  571.     suba.l    a1,a1
  572.     jsr    -$126(a6)
  573.     move.l    (sp)+,a1
  574.     move.l    d0,16(a1)
  575.     lea    P60_reqlist(pc),a0
  576.     move.l    a0,(a0)
  577.     addq.l    #4,(a0)
  578.     clr.l    4(a0)
  579.     move.l    a0,8(a0)
  580.  
  581.     lea    P60_dat(pc),a1
  582.     move.l    a1,P60_reqdata-P60_cn(a3)
  583.     lea    P60_allocreq(pc),a1
  584.     lea    P60_audiodev(pc),a0
  585.     moveq    #0,d0
  586.     moveq    #0,d1
  587.     move.l    4.w,a6
  588.     jsr    -$1bc(a6)
  589.     tst.b    d0
  590.     bne    P60_err
  591.     st.b    P60_audioopen-P60_cn(a3)
  592.  
  593.     lea    P60_timerint(pc),a1
  594.     move.l    a1,P60_timerdata-P60_cn(a3)
  595.     lea    P60_lev6server(pc),a1
  596.     move.l    a1,P60_timerdata+8-P60_cn(a3)
  597.  
  598.     moveq    #0,d3
  599.     lea    P60_cianame(pc),a1
  600.     move.b    #'b',3(a1)
  601. P60_openciares
  602.     moveq    #0,d0
  603.     jsr    -$1f2(a6)
  604.     move.l    d0,P60_ciares-P60_cn(a3)
  605.     beq.b    P60_tryCIAA
  606.     move.l    d0,a6
  607.     lea    P60_timerinterrupt(pc),a1
  608.     moveq    #0,d0
  609.     jsr    -6(a6)
  610.     tst.l    d0
  611.     beq.b    P60_gottimer
  612.     addq.l    #4,d3
  613.     lea    P60_timerinterrupt(pc),a1
  614.     moveq    #1,d0
  615.     jsr    -6(a6)
  616.     tst.l    d0
  617.     beq.b    P60_gottimer
  618. P60_tryCIAA
  619.     lea    P60_cianame(pc),a1
  620.     cmp.b    #'b',3(a1)
  621.     bne.b    P60_err
  622.     subq.b    #1,3(a1)
  623.     moveq    #8,d3
  624.     bra.b    P60_openciares
  625.  
  626. P60_gottimer
  627.     lea    P60_craddr+8(pc),a6
  628.     move.l    P60_ciaaddr(pc,d3),d0
  629.     move.l    d0,(a6)
  630.     sub    #$100,d0
  631.     move.l    d0,-(a6)
  632.     moveq    #2,d3
  633.     btst    #9,d0
  634.     bne.b    P60_timerB
  635.     subq.b    #1,d3
  636.     add    #$100,d0
  637. P60_timerB
  638.     add    #$900,d0
  639.     move.l    d0,-(a6)
  640.     move.l    d0,a0
  641.     and.b    #%10000000,(a0)
  642.     move.b    d3,P60_timeropen-P60_cn(a3)
  643.     moveq    #0,d0
  644.  
  645.     move.l    P60_craddr+4(pc),a1
  646.     move.b    P60_tlo(pc),(a1)
  647.     move.b    P60_thi(pc),$100(a1)
  648.     or.b    #$19,(a0)
  649. P60_pois
  650.     move.l    (sp)+,a6
  651.     rts
  652.  
  653. P60_err    moveq    #-1,d0
  654.     bra.b    P60_pois
  655.     rts
  656.  
  657. P60_ciaaddr
  658.     dc.l    $bfd500,$bfd700,$bfe501,$bfe701
  659.     endc
  660.  
  661. ;­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­
  662. ;­         Call P60_End to stop the music        ­
  663. ;­   A6 --> Customchip baseaddress ($DFF000)    ­
  664. ;­        Uses D0/D1/A0/A1/A3        ­
  665. ;­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­
  666.     
  667. P60_End    moveq    #0,d0
  668.     move    d0,$a8(a6)
  669.     move    d0,$b8(a6)
  670.     move    d0,$c8(a6)
  671.     move    d0,$d8(a6)
  672.     move    #$f,$96(a6)
  673.  
  674.     and.b    #~2,$bfe001
  675.     move.b    P60_ofilter(pc),d0
  676.     or.b    d0,$bfe001
  677.  
  678.     ifeq    system
  679.     move    #$2000,$9a(a6)
  680.     move.l    P60_vektori(pc),a0
  681.     move.l    P60_oldlev6(pc),(a0)
  682.     endc
  683.     
  684.     ifne    system
  685.     move.l    a6,-(sp)
  686.     lea    P60_cn(pc),a3
  687.     moveq    #0,d0
  688.     move.b    P60_timeropen(pc),d0
  689.     beq.b    P60_rem1
  690.     move.l    P60_ciares(pc),a6
  691.     lea    P60_timerinterrupt(pc),a1
  692.     subq.b    #1,d0
  693.     jsr    -12(a6)
  694. P60_rem1
  695.     move.l    4.w,a6
  696.     tst.b    P60_audioopen-P60_cn(a3)
  697.     beq.b    P60_rem2
  698.     lea    P60_allocreq(pc),a1
  699.     jsr    -$1c2(a6)
  700.     clr.b    P60_audioopen-P60_cn(a3)
  701. P60_rem2
  702.     moveq    #0,d0
  703.     move.b    P60_sigbit(pc),d0
  704.     bmi.b    P60_rem3
  705.     jsr    -$150(a6)
  706.     st    P60_sigbit-P60_cn(a3)
  707. P60_rem3
  708.     move.l    (sp)+,a6
  709.     endc
  710.     rts
  711.  
  712.     ifne    fade
  713. P60_mfade
  714.     move    P60_master(pc),d0
  715.     move    P60_temp0+P60_Shadow(pc),d1
  716.     mulu    d0,d1
  717.     lsr    #6,d1
  718.     move    d1,$a8(a6)
  719.  
  720.     ifgt    channels-1
  721.     move    P60_temp1+P60_Shadow(pc),d1
  722.     mulu    d0,d1
  723.     lsr    #6,d1
  724.     move    d1,$b8(a6)
  725.     endc
  726.  
  727.     ifgt    channels-2
  728.     move    P60_temp2+P60_Shadow(pc),d1
  729.     mulu    d0,d1
  730.     lsr    #6,d1
  731.     move    d1,$c8(a6)
  732.     endc
  733.  
  734.     ifgt    channels-3
  735.     move    P60_temp3+P60_Shadow(pc),d1
  736.     mulu    d0,d1
  737.     lsr    #6,d1
  738.     move    d1,$d8(a6)
  739.     endc
  740.     rts
  741.     endc
  742.     
  743. ;­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­
  744. ;­ Call P60_Music every frame to play the music    ­
  745. ;­ A6 --> Customchip baseaddress ($DFF000)    ­
  746. ;­              Uses A0-A5/D0-D7        ­
  747. ;­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­
  748.  
  749. P60_Music
  750.     lea    P60_cn(pc),a3
  751.  
  752.     tst    P60_play-P60_cn(a3)
  753.     bne.b    P60_ohitaaa
  754.     ifne    CIA
  755.     ifeq    system
  756.     move.l    P60_vektori(pc),a5
  757.     move.l    P60_tintti(pc),(a5)
  758.     move.b    P60_tlo2(pc),$bfd400
  759.     move.b    P60_thi2(pc),$bfd500
  760.     endc
  761.     ifne    system
  762.     move.l    P60_craddr+4(pc),a0
  763.     move.b    P60_tlo2(pc),(a0)
  764.     move.b    P60_thi2(pc),$100(a0)
  765.     endc
  766.     endc
  767.     rts
  768.  
  769. P60_ohitaaa
  770.     ifne    fade
  771.     pea    P60_mfade(pc)
  772.     endc
  773.  
  774.     moveq    #Channel_Block_SIZE,d6
  775.     moveq    #16,d7
  776.  
  777.     move    (a3),d4
  778.     addq    #1,d4
  779.     cmp    P60_speed(pc),d4
  780.     beq    P60_playtime
  781.  
  782.     move    d4,(a3)
  783.  
  784. P60_delay
  785.     ifne    CIA
  786.     ifeq    system
  787.     move.l    P60_vektori(pc),a5
  788.     move.l    P60_tintti(pc),(a5)
  789.     move.b    P60_tlo2(pc),$bfd400
  790.     move.b    P60_thi2(pc),$bfd500
  791.     endc
  792.     ifne    system
  793.     move.l    P60_craddr+4(pc),a0
  794.     move.b    P60_tlo2(pc),(a0)
  795.     move.b    P60_thi2(pc),$100(a0)
  796.     endc
  797.     endc
  798.  
  799.     lea    P60_temp0(pc),a5
  800.     lea    $a0(a6),a4
  801.  
  802.     moveq    #channels-1,d5
  803. P60_lopas
  804.     tst    P60_OnOff(a5)
  805.     beq    P60_contfxdone
  806.     moveq    #$f,d0
  807.     and    (a5),d0
  808.  
  809.     add    d0,d0
  810.     move    P60_jtab2(pc,d0),d0
  811.  
  812.     jmp    P60_jtab2(pc,d0)
  813.  
  814. P60_jtab2
  815.     dc    P60_contfxdone-P60_jtab2
  816.  
  817.     ifne    P60_pu
  818.     dc    P60_portup-P60_jtab2
  819.     endc
  820.     ifeq    P60_pu
  821.     dc    P60_contfxdone-P60_jtab2
  822.     endc
  823.  
  824.     ifne    P60_pd
  825.     dc    P60_portdwn-P60_jtab2
  826.     endc
  827.     ifeq    P60_pd
  828.     dc    P60_contfxdone-P60_jtab2
  829.     endc
  830.  
  831.     ifne    P60_tp
  832.     dc    P60_toneport-P60_jtab2
  833.     endc
  834.     ifeq    P60_tp
  835.     dc    P60_contfxdone-P60_jtab2
  836.     endc
  837.  
  838.     ifne    P60_vib
  839.     dc    P60_vib2-P60_jtab2
  840.     endc
  841.     ifeq    P60_vib
  842.     dc    P60_contfxdone-P60_jtab2
  843.     endc
  844.  
  845.     ifne    P60_tpvs
  846.     dc    P60_tpochvslide-P60_jtab2
  847.     endc
  848.     ifeq    P60_tpvs
  849.     dc    P60_contfxdone-P60_jtab2
  850.     endc
  851.  
  852.     ifne    P60_vbvs
  853.     dc    P60_vibochvslide-P60_jtab2
  854.     endc
  855.     ifeq    P60_vbvs
  856.     dc    P60_contfxdone-P60_jtab2
  857.     endc
  858.  
  859.     ifne    P60_tre
  860.     dc    P60_tremo-P60_jtab2
  861.     endc
  862.     ifeq    P60_tre
  863.     dc    P60_contfxdone-P60_jtab2
  864.     endc
  865.  
  866.     ifne    P60_arp
  867.     dc    P60_arpeggio-P60_jtab2
  868.     endc
  869.     ifeq    P60_arp
  870.     dc    P60_contfxdone-P60_jtab2
  871.     endc
  872.  
  873.     dc    P60_contfxdone-P60_jtab2
  874.  
  875.     ifne    P60_vs
  876.     dc    P60_volslide-P60_jtab2
  877.     endc
  878.     ifeq    P60_vs
  879.     dc    P60_contfxdone-P60_jtab2
  880.     endc
  881.  
  882.     dc    P60_contfxdone-P60_jtab2
  883.     dc    P60_contfxdone-P60_jtab2
  884.     dc    P60_contfxdone-P60_jtab2
  885.  
  886.     ifne    P60_ec
  887.     dc    P60_contecommands-P60_jtab2
  888.     endc
  889.     ifeq    P60_ec
  890.     dc    P60_contfxdone-P60_jtab2
  891.     endc
  892.     dc    P60_contfxdone-P60_jtab2
  893.  
  894.  
  895.     ifne    P60_ec
  896. P60_contecommands
  897.     move.b    P60_Info(a5),d0
  898.     and    #$f0,d0
  899.     lsr    #3,d0
  900.     move    P60_etab2(pc,d0),d0
  901.     jmp    P60_etab2(pc,d0)
  902.  
  903. P60_etab2
  904.     dc    P60_contfxdone-P60_etab2
  905.  
  906.     ifne    P60_fsu
  907.     dc    P60_fineup2-P60_etab2
  908.     endc
  909.     ifeq    P60_fsu
  910.     dc    P60_contfxdone-P60_etab2
  911.     endc
  912.  
  913.     ifne    P60_fsd
  914.     dc    P60_finedwn2-P60_etab2
  915.     endc
  916.     ifeq    P60_fsd
  917.     dc    P60_contfxdone-P60_etab2
  918.     endc
  919.  
  920.     dc    P60_contfxdone-P60_etab2
  921.     dc    P60_contfxdone-P60_etab2
  922.  
  923.     dc    P60_contfxdone-P60_etab2
  924.     dc    P60_contfxdone-P60_etab2
  925.  
  926.     dc    P60_contfxdone-P60_etab2
  927.     dc    P60_contfxdone-P60_etab2
  928.  
  929.     ifne    P60_rt
  930.     dc    P60_retrig-P60_etab2
  931.     endc
  932.     ifeq    P60_rt
  933.     dc    P60_contfxdone-P60_etab2
  934.     endc
  935.  
  936.     ifne    P60_fvu
  937.     dc    P60_finevup2-P60_etab2
  938.     endc
  939.     ifeq    P60_fvu
  940.     dc    P60_contfxdone-P60_etab2
  941.     endc
  942.  
  943.     ifne    P60_fvd
  944.     dc    P60_finevdwn2-P60_etab2
  945.     endc
  946.     ifeq    P60_fvd
  947.     dc    P60_contfxdone-P60_etab2
  948.     endc
  949.  
  950.     ifne    P60_fvd
  951.     dc    P60_notecut-P60_etab2
  952.     endc
  953.     ifeq    P60_fvd
  954.     dc    P60_contfxdone-P60_etab2
  955.     endc
  956.  
  957.     ifne    P60_nd
  958.     dc    P60_notedelay-P60_etab2
  959.     endc
  960.     ifeq    P60_nd
  961.     dc    P60_contfxdone-P60_etab2
  962.     endc
  963.  
  964.     dc    P60_contfxdone-P60_etab2
  965.     dc    P60_contfxdone-P60_etab2
  966.     endc
  967.  
  968.     ifne    P60_fsu
  969. P60_fineup2
  970.     tst    (a3)
  971.     bne    P60_contfxdone
  972.     moveq    #$f,d0
  973.     and.b    P60_Info(a5),d0
  974.     sub    d0,P60_Period(a5)
  975.     moveq    #113,d0
  976.     cmp    P60_Period(a5),d0
  977.     ble.b    .jup
  978.     move    d0,P60_Period(a5)
  979. .jup    move    P60_Period(a5),6(a4)
  980.     bra    P60_contfxdone
  981.     endc
  982.  
  983.     ifne    P60_fsd
  984. P60_finedwn2
  985.     tst    (a3)
  986.     bne    P60_contfxdone
  987.     moveq    #$f,d0
  988.     and.b    P60_Info(a5),d0
  989.     add    d0,P60_Period(a5)
  990.     cmp    #856,P60_Period(a5)
  991.     ble.b    .jup
  992.     move    #856,P60_Period(a5)
  993. .jup    move    P60_Period(a5),6(a4)
  994.     bra    P60_contfxdone
  995.     endc
  996.  
  997.     ifne    P60_fvu
  998. P60_finevup2
  999.     tst    (a3)
  1000.     bne    P60_contfxdone
  1001.     moveq    #$f,d0
  1002.     and.b    P60_Info(a5),d0
  1003.     add    d0,P60_Volume(a5)
  1004.     moveq    #64,d0
  1005.     cmp    P60_Volume(a5),d0
  1006.     bge.b    .jup
  1007.     move    d0,P60_Volume(a5)
  1008. .jup    move    P60_Volume(a5),8(a4)
  1009.     bra    P60_contfxdone
  1010.     endc
  1011.  
  1012.     ifne    P60_fvd
  1013. P60_finevdwn2
  1014.     tst    (a3)
  1015.     bne    P60_contfxdone
  1016.     moveq    #$f,d0
  1017.     and.b    P60_Info(a5),d0
  1018.     sub    d0,P60_Volume(a5)
  1019.     bpl.b    .jup
  1020.     clr    P60_Volume(a5)
  1021. .jup    move    P60_Volume(a5),8(a4)
  1022.     bra    P60_contfxdone
  1023.     endc
  1024.  
  1025.     ifne    P60_nc
  1026. P60_notecut
  1027.     moveq    #$f,d0
  1028.     and.b    P60_Info(a5),d0
  1029.     cmp    (a3),d0
  1030.     bne    P60_contfxdone
  1031.     ifeq    fade
  1032.     clr    8(a4)
  1033.     endc
  1034.     ifne    fade
  1035.     clr    P60_Shadow(a5)
  1036.     endc
  1037.     clr    P60_Volume(a5)
  1038.     bra    P60_contfxdone
  1039.     endc
  1040.  
  1041.     ifne    P60_nd
  1042. P60_notedelay
  1043.     moveq    #$f,d0
  1044.     and.b    P60_Info(a5),d0
  1045.     cmp    (a3),d0
  1046.     bne    P60_contfxdone
  1047.  
  1048.     moveq    #$7e,d0
  1049.     and.b    (a5),d0
  1050.     beq    P60_contfxdone
  1051.     move    P60_DMABit(a5),d0
  1052.     move    d0,$96(a6)
  1053.     or    d0,P60_dma-P60_cn(a3)
  1054.     move.l    P60_Sample(a5),a1
  1055.     move.l    (a1)+,(a4)+
  1056.     move    (a1),(a4)+
  1057.     move    P60_Period(a5),(a4)
  1058.     subq.l    #6,a4
  1059.     ifeq    system
  1060.     lea    P60_dmason(pc),a1
  1061.     move.l    P60_vektori(pc),a0
  1062.     move.l    a1,(a0)
  1063.     endc
  1064.  
  1065.     ifeq    CIA
  1066.     move.b    #$19,$bfde00
  1067.     endc
  1068.     ifne    CIA
  1069.     ifeq    system
  1070.     move.b    #$4a,$bfd400
  1071.     move.b    #1,$bfd500
  1072.     endc
  1073.     ifne    system
  1074.     move    #1,P60_server-P60_cn(a3)
  1075.     move.l    P60_craddr+4(pc),a1
  1076.     move.b    #$4a,(a1)
  1077.     move.b    #1,$100(a1)
  1078.     endc
  1079.     endc
  1080.  
  1081.     bra    P60_contfxdone
  1082.     endc
  1083.  
  1084.     ifne    P60_rt
  1085. P60_retrig
  1086.     subq    #1,P60_RetrigCount(a5)
  1087.     bne    P60_contfxdone
  1088.     move    P60_DMABit(a5),d0
  1089.     move    d0,$96(a6)
  1090.     or    d0,P60_dma-P60_cn(a3)
  1091.     move.l    P60_Sample(a5),a1
  1092.     move.l    (a1)+,(a4)
  1093.     move    (a1),4(a4)
  1094.  
  1095.     ifeq    system
  1096.     lea    P60_dmason(pc),a1
  1097.     move.l    P60_vektori(pc),a0
  1098.     move.l    a1,(a0)
  1099.     endc
  1100.  
  1101.     ifeq    CIA
  1102.     move.b    #$19,$bfde00
  1103.     endc
  1104.     ifne    CIA
  1105.     ifeq    system
  1106.     move.b    #$4a,$bfd400
  1107.     move.b    #1,$bfd500
  1108.     endc
  1109.     ifne    system
  1110.     move    #1,P60_server-P60_cn(a3)
  1111.     move.l    P60_craddr+4(pc),a1
  1112.     move.b    #$4a,(a1)
  1113.     move.b    #1,$100(a1)
  1114.     endc
  1115.     endc
  1116.  
  1117.     moveq    #$f,d0
  1118.     and.b    P60_Info(a5),d0
  1119.     move    d0,P60_RetrigCount(a5)
  1120.     bra    P60_contfxdone
  1121.     endc
  1122.  
  1123.     ifne    P60_arp
  1124. P60_arplist
  1125.     dc.b 0,1,2,0,1,2,0,1,2,0,1,2,0,1,2,0,1,2,0,1,2,0,1,2,0,1,2,0,1,2,0,1
  1126.  
  1127. P60_arpeggio
  1128.     move    (a3),d0
  1129.     move.b    P60_arplist(pc,d0),d0
  1130.     beq.b    .arp0
  1131.     subq.b    #1,d0
  1132.     beq.b    P60_arp1
  1133.     moveq    #$f,d0
  1134.     and.b    P60_Info(a5),d0
  1135.     bra.b    P60_arp3
  1136.  
  1137. .arp0    move    P60_Note(a5),d0
  1138.     move    P60_periods(pc,d0),6(a4)
  1139.     bra    P60_contfxdone
  1140. P60_arp1
  1141.     move.b    P60_Info(a5),d0
  1142.     lsr    #4,d0
  1143. P60_arp3
  1144.     add    d0,d0
  1145.     add    P60_Note(a5),d0
  1146.     move    P60_periods(pc,d0),6(a4)
  1147.     bra    P60_contfxdone
  1148.     endc
  1149.  
  1150. P60_periods
  1151.     ifne    P60_ft
  1152.     incbin    periods
  1153.     endc
  1154.     ifeq    P60_ft
  1155.     incbin    periods.nft
  1156.     endc
  1157.  
  1158.     ifne    P60_vs
  1159. P60_volslide
  1160.     move.b    P60_Info(a5),d0
  1161.     sub.b    d0,P60_Volume+1(a5)
  1162.     bpl.b    .test
  1163.     clr    P60_Volume(a5)
  1164.     ifeq    fade
  1165.     clr    8(a4)
  1166.     endc
  1167.     ifne    fade
  1168.     clr    P60_Shadow(a5)
  1169.     endc
  1170.     bra    P60_contfxdone
  1171. .test    moveq    #64,d0
  1172.     cmp    P60_Volume(a5),d0
  1173.     bge.b    .ncs
  1174.     move    d0,P60_Volume(a5)
  1175.     ifeq    fade
  1176.     move    d0,8(a4)
  1177.     endc
  1178.     ifne    fade
  1179.     move    d0,P60_Shadow(a5)
  1180.     endc
  1181.     bra.b    P60_contfxdone
  1182. .ncs    
  1183.     ifeq    fade
  1184.     move    P60_Volume(a5),8(a4)
  1185.     endc
  1186.     ifne    fade
  1187.     move    P60_Volume(a5),P60_Shadow(a5)
  1188.     endc
  1189.     bra.b    P60_contfxdone
  1190.     endc
  1191.  
  1192.     ifne    P60_tpvs
  1193. P60_tpochvslide
  1194.     move.b    P60_Info(a5),d0
  1195.     sub.b    d0,P60_Volume+1(a5)
  1196.     bpl.b    .test
  1197.     clr    P60_Volume(a5)
  1198.     ifeq    fade
  1199.     clr    8(a4)
  1200.     endc
  1201.     ifne    fade
  1202.     clr    P60_Shadow(a5)
  1203.     endc
  1204.     bra.b    P60_toneport
  1205. .test    moveq    #64,d0
  1206.     cmp    P60_Volume(a5),d0
  1207.     bge.b    .ncs
  1208.     move    d0,P60_Volume(a5)
  1209. .ncs
  1210.     ifeq    fade
  1211.     move    P60_Volume(a5),8(a4)
  1212.     endc
  1213.     ifne    fade
  1214.     move    P60_Volume(a5),P60_Shadow(a5)
  1215.     endc
  1216.     endc
  1217.  
  1218.     ifne    P60_tp
  1219. P60_toneport
  1220.     move    P60_ToPeriod(a5),d0
  1221.     beq.b    P60_contfxdone
  1222.     move    P60_TPSpeed(a5),d1
  1223.     cmp    P60_Period(a5),d0
  1224.     blt.b    .topoup
  1225.  
  1226.     add    d1,P60_Period(a5)
  1227.     cmp    P60_Period(a5),d0
  1228.     bgt.b    P60_toposetper
  1229.     move    d0,P60_Period(a5)
  1230.     clr    P60_ToPeriod(a5)
  1231.     move    d0,6(a4)
  1232.     bra.b    P60_contfxdone
  1233.  
  1234. .topoup
  1235.     sub    d1,P60_Period(a5)
  1236.     cmp    P60_Period(a5),d0
  1237.     blt.b    P60_toposetper
  1238.     move    d0,P60_Period(a5)
  1239.     clr    P60_ToPeriod(a5)
  1240. P60_toposetper
  1241.     move    P60_Period(a5),6(a4)
  1242.     endc    
  1243.     ifeq    P60_tp
  1244.     nop
  1245.     endc
  1246.  
  1247. P60_contfxdone
  1248.     ifne    P60_il
  1249.     bsr    P60_funk2
  1250.     endc
  1251.  
  1252.     add.l    d6,a5
  1253.     add.l    d7,a4
  1254.     dbf    d5,P60_lopas
  1255.  
  1256.     cmp    P60_speed2(pc),d4
  1257.     beq.b    P60_preplay
  1258.     rts
  1259.  
  1260.     ifne    P60_pu
  1261. P60_portup
  1262.     moveq    #0,D0
  1263.     move.b    P60_Info(a5),d0
  1264.     sub    d0,P60_Period(a5)
  1265.     moveq    #113,d0
  1266.     cmp    P60_Period(a5),d0
  1267.     ble.b    .skip
  1268.     move    d0,P60_Period(a5)
  1269.     move    d0,6(a4)
  1270.     bra.b    P60_contfxdone
  1271. .skip
  1272.     move    P60_Period(a5),6(a4)
  1273.     bra.b    P60_contfxdone
  1274.     endc
  1275.  
  1276.     ifne    P60_pd
  1277. P60_portdwn
  1278.     moveq    #0,d0
  1279.     move.b    P60_Info(a5),d0
  1280.     add    d0,P60_Period(a5)
  1281.     cmp    #856,P60_Period(a5)
  1282.     ble.b    .skip
  1283.     move    #856,d0
  1284.     move    d0,P60_Period(a5)
  1285.     move    d0,6(a4)
  1286.     bra.b    P60_contfxdone
  1287. .skip
  1288.     move    P60_Period(a5),6(a4)
  1289.     bra.b    P60_contfxdone
  1290.     endc
  1291.  
  1292. P60_preplay
  1293.     ifne    P60_pde
  1294.     tst    P60_pdelay-P60_cn(a3)
  1295.     beq.b    .djdj
  1296.     rts
  1297. .djdj
  1298.     endc
  1299.  
  1300.     lea    P60_temp0(pc),a5
  1301.     lea    P60_Samples-16(pc),a0
  1302.  
  1303.     moveq    #channels-1,d5
  1304. P60_loaps
  1305.     ifne    P60_pl
  1306.     lea    P60_TData(a5),a1
  1307.     move    2(a5),(a1)+
  1308.     move.l    P60_ChaPos(a5),(a1)+
  1309.     move.l    P60_TempPos(a5),(a1)+
  1310.     move    P60_TempLen(a5),(a1)
  1311.     endc
  1312.  
  1313.     tst.b    P60_Pack(a5)
  1314.     beq.b    P60_takeone
  1315.     bmi.b    .keepsame
  1316.  
  1317.     subq.b    #1,P60_Pack(a5)
  1318.     clr    P60_OnOff(a5)
  1319.     add.l    d6,a5
  1320.     dbf    d5,P60_loaps
  1321.     rts
  1322.  
  1323. .keepsame
  1324.     addq.b    #1,P60_Pack(a5)
  1325.     bra.b    P60_dko
  1326.  
  1327. P60_takeone
  1328.     tst.b    P60_TempLen+1(a5)
  1329.     beq.b    P60_takenorm
  1330.  
  1331.     subq.b    #1,P60_TempLen+1(a5)
  1332.     move.l    P60_TempPos(a5),a2
  1333.  
  1334. P60_jedi
  1335.     move.b    (a2)+,(a5)
  1336.     bpl.b    P60_normal
  1337.     not.b    (a5)+
  1338.     move.b    (a2)+,(a5)+
  1339.  
  1340.     move.b    (a2)+,(a5)+
  1341.     move.b    (a2)+,(a5)+
  1342.  
  1343.     subq.l    #4,a5
  1344.     move.l    a2,P60_TempPos(a5)
  1345.     bra.b    P60_dko
  1346.     
  1347. P60_normal
  1348.     move.b    (a2)+,1(a5)
  1349.     move.b    (a2)+,2(a5)
  1350.  
  1351.     move.l    a2,P60_TempPos(a5)
  1352.     bra.b    P60_dko
  1353.  
  1354. P60_takenorm
  1355.     move.l    P60_ChaPos(a5),a2
  1356.     move.b    (a2)+,(a5)
  1357.     bmi.b    P60_packed
  1358.  
  1359.     move.b    (a2)+,1(a5)
  1360.     move.b    (a2)+,2(a5)
  1361.  
  1362.     move.l    a2,P60_ChaPos(a5)
  1363.     bra.b    P60_dko
  1364.  
  1365. P60_kuiskus
  1366.     move.b    (a2)+,P60_TempLen+1(a5)
  1367.     moveq    #0,d0
  1368.     move.b    (a2)+,d0
  1369.     lsl    #8,d0
  1370.     move.b    (a2)+,d0
  1371.     
  1372.     move.l    a2,P60_ChaPos(a5)
  1373.     sub.l    d0,a2
  1374.     bra.b    P60_jedi
  1375.  
  1376. P60_packed
  1377.     cmp.b    #$80,(a5)
  1378.     beq.b    P60_kuiskus
  1379.     not.b    (a5)+
  1380.     move.b    (a2)+,(a5)+
  1381.  
  1382.     move.b    (a2)+,(a5)+
  1383.     move.b    (a2)+,(a5)+
  1384.  
  1385.     subq.l    #4,a5
  1386.     move.l    a2,P60_ChaPos(a5)
  1387.  
  1388. P60_dko    st    P60_OnOff(a5)
  1389.     move    (a5),d0
  1390.     and    #$1f0,d0
  1391.     beq.b    .koto
  1392.     lea    (a0,d0),a1
  1393.     move.l    a1,P60_Sample(a5)
  1394.     ifne    P60_ft
  1395.     move.l    P60_SampleVolume(a1),P60_Volume(a5)
  1396.     endc
  1397.     ifeq    P60_ft
  1398.     move    P60_SampleVolume(a1),P60_Volume(a5)
  1399.     endc
  1400.     ifne    P60_il
  1401.     move.l    P60_RepeatOffset(a1),P60_Wave(a5)
  1402.     endc
  1403.     ifne    P60_sof
  1404.     clr    P60_Offset(a5)
  1405.     endc
  1406.  
  1407. .koto    add.l    d6,a5
  1408.     dbf    d5,P60_loaps
  1409.     rts
  1410.  
  1411. P60_playtime
  1412.     clr    (a3)
  1413.     ifne    P60_pde
  1414.     tst    P60_pdelay-P60_cn(a3)
  1415.     beq.b    .djdj
  1416.     subq    #1,P60_pdelay-P60_cn(a3)
  1417.     bra    P60_delay
  1418. .djdj
  1419.     endc
  1420.  
  1421.     tst    P60_speedis1-P60_cn(a3)
  1422.     beq.b    .mo
  1423.     bsr    P60_preplay
  1424.  
  1425. .mo    lea    P60_temp0(pc),a5
  1426.     lea    $a0(a6),a4
  1427.  
  1428.     ifne    system
  1429.     moveq    #1,d4
  1430.     move    d4,P60_server-P60_cn(a3)
  1431.     move.l    P60_craddr+4(pc),a1
  1432.     move.b    #$4a,(a1)
  1433.     move.b    d4,$100(a1)
  1434.     endc
  1435.     ifeq    system
  1436.     lea    P60_dmason(pc),a1
  1437.     move.l    P60_vektori(pc),a2
  1438.     move.l    a1,(a2)
  1439.  
  1440.     ifeq    CIA
  1441.     move.b    #$19,$bfde00
  1442.     endc
  1443.     ifne    CIA
  1444.     move.b    #$4a,$bfd400
  1445.     move.b    #1,$bfd500
  1446.     endc
  1447.     endc
  1448.  
  1449.     lea    P60_periods(pc),a2
  1450.  
  1451.     moveq    #0,d4
  1452.     moveq    #channels-1,d5
  1453. P60_los    tst    P60_OnOff(a5)
  1454.     beq.b    P60_nocha
  1455.  
  1456.     moveq    #$f,d0
  1457.     and    (a5),d0
  1458.     lea    P60_jtab(pc),a1
  1459.     add    d0,d0
  1460.     add.l    d0,a1
  1461.     add    (a1),a1
  1462.     jmp    (a1)
  1463.  
  1464. P60_fxdone
  1465.     moveq    #$7e,d0
  1466.     and.b    (a5),d0
  1467.     beq.b    P60_nocha
  1468.     ifne    P60_vib
  1469.     clr.b    P60_VibPos(a5)
  1470.     endc
  1471.     ifne    P60_tre
  1472.     clr.b    P60_TrePos(a5)
  1473.     endc
  1474.  
  1475.      ifne    P60_ft
  1476.     add    P60_Fine(a5),d0
  1477.     endc
  1478.     move    d0,P60_Note(a5)
  1479.     move    (a2,d0),P60_Period(a5)
  1480.  
  1481. P60_zample
  1482.     ifne    P60_sof
  1483.     tst    P60_Offset(a5)
  1484.     bne    P60_pek
  1485.     endc
  1486.  
  1487.     or    P60_DMABit(a5),d4
  1488.     move    d4,$96(a6)
  1489.     move.l    P60_Sample(a5),a1
  1490.     move.l    (a1)+,(a4)
  1491.     move    (a1),4(a4)
  1492.  
  1493. P60_nocha
  1494.     ifeq    fade
  1495.     move.l    P60_Period(a5),6(a4)
  1496.     endc
  1497.     ifne    fade
  1498.     move    P60_Period(a5),6(a4)
  1499.     move    P60_Volume(a5),P60_Shadow(a5)
  1500.     endc
  1501.  
  1502. P60_skip
  1503.     ifne    P60_il
  1504.     bsr    P60_funk2
  1505.     endc
  1506.  
  1507.     add.l    d6,a5
  1508.     add.l    d7,a4
  1509.     dbf    d5,P60_los
  1510.  
  1511.     move.b    d4,P60_dma+1-P60_cn(a3)
  1512.  
  1513.     ifne    P60_pl
  1514.     tst.b    P60_plflag+1-P60_cn(a3)
  1515.     beq.b    P60_ohittaa
  1516.  
  1517.     lea    P60_temp0(pc),a1
  1518.     lea    P60_looppos(pc),a0
  1519.     moveq    #channels-1,d0
  1520. .talt    move.b    1(a0),3(a1)
  1521.     addq.l    #2,a0
  1522.     move.l    (a0)+,P60_ChaPos(a1)
  1523.     move.l    (a0)+,P60_TempPos(a1)
  1524.     move    (a0)+,P60_TempLen(a1)
  1525.     add.l    d6,a1
  1526.     dbf    d0,.talt
  1527.  
  1528.     move    P60_plrowpos(pc),P60_rowpos-P60_cn(a3)
  1529.     clr.b    P60_plflag+1-P60_cn(a3)
  1530.     rts
  1531.     endc
  1532.  
  1533. P60_ohittaa
  1534.     subq    #1,P60_rowpos-P60_cn(a3)
  1535.     bmi.b    P60_nextpattern
  1536.     rts
  1537.  
  1538. P60_nextpattern
  1539.     ifne    P60_pl
  1540.     clr    P60_plflag-P60_cn(a3)
  1541.     endc
  1542.     move.l    P60_patternbase(pc),a4
  1543.     moveq    #63,d0
  1544.     move    d0,P60_rowpos-P60_cn(a3)
  1545.     move.l    P60_spos(pc),a1
  1546.     move.b    (a1)+,d0
  1547.     bpl.b    P60_dk
  1548.     move.l    P60_possibase(pc),a1
  1549.     move.b    (a1)+,d0
  1550. P60_dk    move.l    a1,P60_spos-P60_cn(a3)
  1551.     lsl    #3,d0
  1552.     move.l    P60_positionbase(pc),a1
  1553.     add.l    d0,a1
  1554.  
  1555.     move    (a1)+,d0
  1556.     lea    (a4,d0.l),a2
  1557.     move.l    a2,P60_ChaPos+P60_temp0-P60_cn(a3)
  1558.     move    (a1)+,d0
  1559.     lea    (a4,d0.l),a2
  1560.     move.l    a2,P60_ChaPos+P60_temp1-P60_cn(a3)
  1561.     move    (a1)+,d0
  1562.     lea    (a4,d0.l),a2
  1563.     move.l    a2,P60_ChaPos+P60_temp2-P60_cn(a3)
  1564.     move    (a1),d0
  1565.     add.l    d0,a4
  1566.     move.l    a4,P60_ChaPos+P60_temp3-P60_cn(a3)
  1567.     rts
  1568.  
  1569.     ifne    P60_tp
  1570. P60_settoneport
  1571.     move.b    P60_Info(a5),d0
  1572.     beq.b    P60_toponochange
  1573.     move.b    d0,P60_TPSpeed+1(a5)
  1574. P60_toponochange
  1575.     moveq    #$7e,d0
  1576.     and.b    (a5),d0
  1577.     beq    P60_nocha
  1578.     add    P60_Fine(a5),d0
  1579.     move    d0,P60_Note(a5)
  1580.     move    (a2,d0),P60_ToPeriod(a5)
  1581.     bra    P60_nocha
  1582.     endc
  1583.  
  1584.     ifne    P60_sof
  1585. P60_sampleoffse
  1586.     moveq    #$7e,d0
  1587.     and.b    (a5),d0
  1588.     beq    P60_nocha
  1589.     ifne    P60_vib
  1590.     clr.b    P60_VibPos(a5)
  1591.     endc
  1592.     ifne    P60_tre
  1593.     clr.b    P60_TrePos(a5)
  1594.     endc
  1595.  
  1596.     ifne    P60_ft
  1597.     add    P60_Fine(a5),d0
  1598.     endc
  1599.     move    d0,P60_Note(a5)
  1600.     move    (a2,d0),P60_Period(a5)
  1601.  
  1602.     moveq    #0,d1
  1603.     move    #$ff00,d1
  1604.     and    2(a5),d1
  1605.     beq.b    P60_pek
  1606.     add    d1,P60_Offset(a5)
  1607. P60_pek    move    P60_Offset(a5),d1
  1608.     move    d1,P60_Offset(a5)
  1609.     or    P60_DMABit(a5),d4
  1610.     move    d4,$96(a6)
  1611.     move.l    P60_Sample(a5),a1
  1612.     move.l    (a1)+,d0
  1613.     add.l    d1,d0
  1614.     move.l    d0,(a4)
  1615.     lsr    #1,d1
  1616.     move    (a1),d0
  1617.     sub    d1,d0
  1618.     bpl.b    P60_offok
  1619.     move.l    -4(a1),(a4)
  1620.     moveq    #1,d0
  1621. P60_offok
  1622.     move    d0,4(a4)
  1623.     bra    P60_nocha
  1624.     endc
  1625.  
  1626.     ifne    P60_vl
  1627. P60_volum
  1628.     move.b    P60_Info(a5),P60_Volume+1(a5)
  1629.     bra    P60_fxdone
  1630.     endc
  1631.  
  1632.     ifne    P60_pj
  1633. P60_posjmp
  1634.     moveq    #0,d0
  1635.     move.b    P60_Info(a5),d0
  1636.     add.l    P60_possibase(pc),d0
  1637.     move.l    d0,P60_spos-P60_cn(a3)
  1638.     endc
  1639.  
  1640.     ifne    P60_pb
  1641. P60_pattbreak
  1642.     moveq    #64,d0
  1643.     move    d0,P60_rowpos-P60_cn(a3)
  1644.     move.l    P60_spos(pc),a1
  1645.     move.l    P60_patternbase(pc),a0
  1646.     move.b    (a1)+,d0
  1647.     bpl.b    P60_dk2
  1648.     move.l    P60_possibase(pc),a1
  1649.     move.b    (a1)+,d0
  1650. P60_dk2    move.l    a1,P60_spos-P60_cn(a3)
  1651.     move.l    P60_positionbase(pc),a1
  1652.     lsl    #3,d0
  1653.     add.l    d0,a1
  1654.     movem    (a1),d0-d3
  1655.     lea    (a0,d0.l),a1
  1656.     move    d1,d0
  1657.     move.l    a1,P60_ChaPos+P60_temp0-P60_cn(a3)
  1658.     lea    (a0,d0.l),a1
  1659.     move.l    a1,P60_ChaPos+P60_temp1-P60_cn(a3)
  1660.     move    d2,d0
  1661.     lea    (a0,d0.l),a1
  1662.     move.l    a1,P60_ChaPos+P60_temp2-P60_cn(a3)
  1663.     move    d3,d0
  1664.     add.l    d0,a0
  1665.     move.l    a0,P60_ChaPos+P60_temp3-P60_cn(a3)
  1666.     bra    P60_fxdone
  1667.     endc
  1668.  
  1669.     ifne    P60_vib
  1670. P60_vibrato
  1671.     move.b    P60_Info(a5),d0
  1672.     beq    P60_fxdone
  1673.     move.b    d0,d1
  1674.     move.b    P60_VibCmd(a5),d2
  1675.     and.b    #$f,d0
  1676.     beq.b    P60_vibskip
  1677.     and.b    #$f0,d2
  1678.     or.b    d0,d2
  1679. P60_vibskip
  1680.     and.b    #$f0,d1
  1681.     beq.b    P60_vibskip2
  1682.     and.b    #$f,d2
  1683.     or.b    d1,d2
  1684. P60_vibskip2
  1685.     move.b    d2,P60_VibCmd(a5)
  1686.     bra    P60_fxdone
  1687.     endc
  1688.  
  1689.     ifne    P60_tre
  1690. P60_settremo
  1691.     move.b    P60_Info(a5),d0
  1692.     beq    P60_fxdone
  1693.     move.b    d0,d1
  1694.     move.b    P60_TreCmd(a5),d2
  1695.     moveq    #$f,d3
  1696.     and.b    d3,d0
  1697.     beq.b    P60_treskip
  1698.     and.b    #$f0,d2
  1699.     or.b    d0,d2
  1700. P60_treskip
  1701.     and.b    #$f0,d1
  1702.     beq.b    P60_treskip2
  1703.     and.b    d3,d2
  1704.     or.b    d1,d2
  1705. P60_treskip2
  1706.     move.b    d2,P60_TreCmd(a5)
  1707.     bra    P60_fxdone
  1708.     endc
  1709.  
  1710.     ifne    P60_ec
  1711. P60_ecommands
  1712.     move.b    P60_Info(a5),d0
  1713.     and.b    #$f0,d0
  1714.     lsr    #3,d0
  1715.     move    P60_etab(pc,d0),d0
  1716.     jmp    P60_etab(pc,d0)
  1717.  
  1718. P60_etab
  1719.     ifne    P60_fi
  1720.     dc    P60_filter-P60_etab
  1721.     endc
  1722.     ifeq    P60_fi
  1723.     dc    P60_fxdone-P60_etab
  1724.     endc
  1725.  
  1726.     ifne    P60_fsu
  1727.     dc    P60_fineup-P60_etab
  1728.     endc
  1729.     ifeq    P60_fsu
  1730.     dc    P60_fxdone-P60_etab
  1731.     endc
  1732.  
  1733.     ifne    P60_fsd
  1734.     dc    P60_finedwn-P60_etab
  1735.     endc
  1736.     ifeq    P60_fsd
  1737.     dc    P60_fxdone-P60_etab
  1738.     endc
  1739.  
  1740.     dc    P60_fxdone-P60_etab
  1741.     dc    P60_fxdone-P60_etab
  1742.  
  1743.     ifne    P60_sft
  1744.     dc    P60_setfinetune-P60_etab
  1745.     endc
  1746.     ifeq    P60_sft
  1747.     dc    P60_fxdone-P60_etab
  1748.     endc
  1749.  
  1750.     ifne    P60_pl
  1751.     dc    P60_patternloop-P60_etab
  1752.     endc
  1753.     ifeq    P60_pl
  1754.     dc    P60_fxdone-P60_etab
  1755.     endc
  1756.  
  1757.     dc    P60_fxdone-P60_etab
  1758.  
  1759.     ifne    P60_timing
  1760.     dc    P60_sete8-P60_etab
  1761.     endc
  1762.     ifeq    P60_timing
  1763.     dc    P60_fxdone-P60_etab
  1764.     endc
  1765.  
  1766.     ifne    P60_rt
  1767.     dc    P60_setretrig-P60_etab
  1768.     endc
  1769.     ifeq    P60_rt
  1770.     dc    P60_fxdone-P60_etab
  1771.     endc
  1772.  
  1773.     ifne    P60_fvu
  1774.     dc    P60_finevup-P60_etab
  1775.     endc
  1776.     ifeq    P60_fvu
  1777.     dc    P60_fxdone-P60_etab
  1778.     endc
  1779.  
  1780.     ifne    P60_fvd
  1781.     dc    P60_finevdwn-P60_etab
  1782.     endc
  1783.     ifeq    P60_fvd
  1784.     dc    P60_fxdone-P60_etab
  1785.     endc
  1786.  
  1787.     dc    P60_fxdone-P60_etab
  1788.  
  1789.     ifne    P60_nd
  1790.     dc    P60_ndelay-P60_etab
  1791.     endc
  1792.     ifeq    P60_nd
  1793.     dc    P60_fxdone-P60_etab
  1794.     endc
  1795.  
  1796.     ifne    P60_pde
  1797.     dc    P60_pattdelay-P60_etab
  1798.     endc
  1799.     ifeq    P60_pde
  1800.     dc    P60_fxdone-P60_etab
  1801.     endc
  1802.  
  1803.     ifne    P60_il
  1804.     dc    P60_funk-P60_etab
  1805.     endc
  1806.     ifeq    P60_il
  1807.     dc    P60_fxdone-P60_etab
  1808.     endc
  1809.     endc
  1810.  
  1811.     ifne    P60_fi
  1812. P60_filter
  1813.     move.b    P60_Info(a5),d0
  1814.     and.b    #$fd,$bfe001
  1815.     or.b    d0,$bfe001
  1816.     bra    P60_fxdone
  1817.     endc
  1818.  
  1819.     ifne    P60_fsu
  1820. P60_fineup
  1821.     P60_getnote
  1822.  
  1823.     moveq    #$f,d0
  1824.     and.b    P60_Info(a5),d0
  1825.     sub    d0,P60_Period(a5)
  1826.     moveq    #113,d0
  1827.     cmp    P60_Period(a5),d0
  1828.     ble.b    .jup
  1829.     move    d0,P60_Period(a5)
  1830. .jup    moveq    #$7e,d0
  1831.     and.b    (a5),d0
  1832.     bne    P60_zample
  1833.     bra    P60_nocha
  1834.     endc
  1835.  
  1836.     ifne    P60_fsd
  1837. P60_finedwn
  1838.     P60_getnote
  1839.  
  1840.     moveq    #$f,d0
  1841.     and.b    P60_Info(a5),d0
  1842.     add    d0,P60_Period(a5)
  1843.     cmp    #856,P60_Period(a5)
  1844.     ble.b    .jup
  1845.     move    #856,P60_Period(a5)
  1846. .jup    moveq    #$7e,d0
  1847.     and.b    (a5),d0
  1848.     bne    P60_zample
  1849.     bra    P60_nocha
  1850.     endc
  1851.  
  1852.     ifne    P60_sft
  1853. P60_setfinetune
  1854.     moveq    #$f,d0
  1855.     and.b    P60_Info(a5),d0
  1856.  
  1857.     add    d0,d0
  1858.     move    P60_mulutab(pc,d0),P60_Fine(a5)
  1859.     bra    P60_fxdone
  1860.  
  1861. P60_mulutab
  1862.     dc    0,74,148,222,296,370,444,518,592,666,740,814,888,962,1036,1110
  1863.     endc
  1864.  
  1865.     ifne    P60_pl
  1866. P60_patternloop
  1867.     moveq    #$f,d0
  1868.     and.b    P60_Info(a5),d0
  1869.     beq.b    P60_setloop
  1870.  
  1871.     tst.b    P60_plflag-P60_cn(a3)
  1872.     bne.b    P60_noset
  1873.  
  1874.     move    d0,P60_plcount-P60_cn(a3)
  1875.     st.b    P60_plflag-P60_cn(a3)
  1876. P60_noset
  1877.     tst    P60_plcount-P60_cn(a3)
  1878.     bne.b    P60_looppaa
  1879.     clr.b    P60_plflag-P60_cn(a3)
  1880.     bra    P60_fxdone
  1881.     
  1882. P60_looppaa
  1883.     st.b    P60_plflag+1-P60_cn(a3)
  1884.     subq    #1,P60_plcount-P60_cn(a3)
  1885.     bra    P60_fxdone
  1886.  
  1887. P60_setloop
  1888.     tst.b    P60_plflag-P60_cn(a3)
  1889.     bne    P60_fxdone
  1890.     move    P60_rowpos(pc),P60_plrowpos-P60_cn(a3)
  1891.     lea    P60_temp0+P60_TData(pc),a1
  1892.     lea    P60_looppos(pc),a0
  1893.     moveq    #channels-1,d0
  1894. .talt    move.l    (a1)+,(a0)+
  1895.     move.l    (a1)+,(a0)+
  1896.     move.l    (a1),(a0)+
  1897.     subq.l    #8,a1
  1898.     add.l    d6,a1
  1899.     dbf    d0,.talt
  1900.     bra    P60_fxdone
  1901.     endc
  1902.  
  1903.     ifne    P60_fvu
  1904. P60_finevup
  1905.     moveq    #$f,d0
  1906.     and.b    P60_Info(a5),d0
  1907.     add    d0,P60_Volume(a5)
  1908.     moveq    #64,d0
  1909.     cmp    P60_Volume(a5),d0
  1910.     bge    P60_fxdone
  1911.     move    d0,P60_Volume(a5)
  1912.     bra    P60_fxdone
  1913.     endc
  1914.  
  1915.     ifne    P60_fvd
  1916. P60_finevdwn
  1917.     moveq    #$f,d0
  1918.     and.b    P60_Info(a5),d0
  1919.     sub    d0,P60_Volume(a5)
  1920.     bpl    P60_fxdone
  1921.     clr    P60_Volume(a5)
  1922.     bra    P60_fxdone
  1923.     endc
  1924.  
  1925.     ifne    P60_timing
  1926. P60_sete8
  1927.     moveq    #$f,d0
  1928.     and.b    P60_Info(a5),d0
  1929.     move    d0,P60_E8-P60_cn(a3)
  1930.     bra    P60_fxdone
  1931.     endc
  1932.  
  1933.     ifne    P60_rt
  1934. P60_setretrig
  1935.     moveq    #$f,d0
  1936.     and.b    P60_Info(a5),d0
  1937.     move    d0,P60_RetrigCount(a5)
  1938.     bra    P60_fxdone
  1939.     endc
  1940.  
  1941.     ifne    P60_nd
  1942. P60_ndelay
  1943.     moveq    #$7e,d0
  1944.     and.b    (a5),d0
  1945.     beq    P60_skip
  1946.     ifne    P60_vib
  1947.     clr.b    P60_VibPos(a5)
  1948.     endc
  1949.     ifne    P60_tre
  1950.     clr.b    P60_TrePos(a5)
  1951.     endc
  1952.     ifne    P60_ft
  1953.     add    P60_Fine(a5),d0
  1954.     endc
  1955.     move    d0,P60_Note(a5)
  1956.     move    (a2,d0),P60_Period(a5)
  1957.     ifeq    fade
  1958.     move    P60_Volume(a5),8(a4)
  1959.     endc
  1960.     ifne    fade
  1961.     move    P60_Volume(a5),P60_Shadow(a5)
  1962.     endc
  1963.     bra    P60_skip
  1964.     endc
  1965.  
  1966.     ifne    P60_pde
  1967. P60_pattdelay
  1968.     moveq    #$f,d0
  1969.     and.b    P60_Info(a5),d0
  1970.     move    d0,P60_pdelay-P60_cn(a3)
  1971.     bra    P60_fxdone
  1972.     endc
  1973.  
  1974.     ifne    P60_sd
  1975. P60_cspeed
  1976.     move.b    P60_Info(a5),d0
  1977.  
  1978.     ifne    CIA
  1979.     tst    P60_Tempo-P60_cn(a3)
  1980.     beq.b    P60_VBlank
  1981.     cmp.b    #32,d0
  1982.     bhs.b    P60_STempo
  1983.     endc
  1984.  
  1985. P60_VBlank
  1986.     cmp.b    #1,d0
  1987.     beq.b    P60_jkd
  1988.  
  1989.     move.b    d0,P60_speed+1-P60_cn(a3)
  1990.     subq.b    #1,d0
  1991.     move.b    d0,P60_speed2+1-P60_cn(a3)
  1992.     clr    P60_speedis1-P60_cn(a3)
  1993.     bra    P60_fxdone
  1994.  
  1995. P60_jkd    move.b    d0,P60_speed+1-P60_cn(a3)
  1996.     move.b    d0,P60_speed2+1-P60_cn(a3)
  1997.     st    P60_speedis1-P60_cn(a3)
  1998.     bra    P60_fxdone
  1999.  
  2000.  
  2001.     ifne    CIA
  2002. P60_STempo
  2003.     move.l    P60_timer(pc),d1
  2004.     divu    d0,d1
  2005.     move    d1,P60_thi2-P60_cn(a3)
  2006.     sub    #$1c8*2,d1
  2007.     move    d1,P60_thi-P60_cn(a3)
  2008.     bra    P60_fxdone
  2009.     endc
  2010.     endc
  2011.  
  2012.     ifne    P60_vbvs
  2013. P60_vibochvslide
  2014.     move.b    P60_Info(a5),d0
  2015.     sub.b    d0,P60_Volume+1(a5)
  2016.     bpl.b    P60_test62
  2017.     clr    P60_Volume(a5)
  2018.     ifeq    fade
  2019.     clr    8(a4)
  2020.     endc
  2021.     ifne    fade
  2022.     clr    P60_Shadow(a5)
  2023.     endc
  2024.     bra.b    P60_vib2
  2025. P60_test62
  2026.     moveq    #64,d0
  2027.     cmp    P60_Volume(a5),d0
  2028.     bge.b    .ncs2
  2029.     move    d0,P60_Volume(a5)
  2030. .ncs2
  2031.     ifeq    fade
  2032.     move    P60_Volume(a5),8(a4)
  2033.     endc
  2034.     ifne    fade
  2035.     move    P60_Volume(a5),P60_Shadow(a5)
  2036.     endc
  2037.     endc
  2038.  
  2039.     ifne    P60_vib
  2040. P60_vib2
  2041.     move    #$f00,d0
  2042.     move    P60_VibCmd(a5),d1
  2043.     and    d1,d0
  2044.     lsr    #2,d0
  2045.     
  2046.     lsr    #1,d1
  2047.     and    #$3e,d1
  2048.     add    d1,d0
  2049.  
  2050.     move    P60_Period(a5),d1
  2051.     tst.b    P60_VibPos(a5)
  2052.     bmi.b    .vibneg
  2053.     add    P60_vibtab(pc,d0),d1
  2054.     bra.b    P60_vib4
  2055.  
  2056. .vibneg    sub    P60_vibtab(pc,d0),d1
  2057.  
  2058. P60_vib4
  2059.     move    d1,6(a4)
  2060.     move.b    P60_VibCmd(a5),d0
  2061.     lsr.b    #2,d0
  2062.     and    #$3c,d0
  2063.     add.b    d0,P60_VibPos(a5)
  2064.     bra    P60_contfxdone
  2065.     endc
  2066.  
  2067.     ifne    P60_tre
  2068. P60_tremo
  2069.     move    #$f00,d0
  2070.     move    P60_TreCmd(a5),d1
  2071.     and    d1,d0
  2072.     lsr    #2,d0
  2073.     
  2074.     lsr    #1,d1
  2075.     and    #$3e,d1
  2076.     add    d1,d0
  2077.  
  2078.     move    P60_Volume(a5),d1
  2079.     tst.b    P60_TrePos(a5)
  2080.     bmi.b    .treneg
  2081.     add    P60_vibtab(pc,d0),d1
  2082.     cmp    #64,d1
  2083.     ble.b    P60_tre4
  2084.     moveq    #64,d1
  2085.     bra.b    P60_tre4
  2086.  
  2087. .treneg    sub    P60_vibtab(pc,d0),d1
  2088.     bpl.b    P60_tre4
  2089.     moveq    #0,d1
  2090. P60_tre4
  2091.     ifeq    fade
  2092.     move    d1,8(a4)
  2093.     endc
  2094.     ifne    fade
  2095.     move    d1,P60_Shadow(a5)
  2096.     endc
  2097.  
  2098.     move.b    P60_TreCmd(a5),d0
  2099.     lsr.b    #2,d0
  2100.     and    #$3c,d0
  2101.     add.b    d0,P60_TrePos(a5)
  2102.     bra    P60_contfxdone
  2103.     endc
  2104.  
  2105.     ifne    P60_vib!P60_tre
  2106. P60_vibtab    incbin    vibtab
  2107.     endc
  2108.  
  2109.     ifne    P60_il
  2110. P60_funk
  2111.     moveq    #$f,d0
  2112.     and.b    P60_Info(a5),d0
  2113.     move.b    d0,P60_Funkspd(a5)
  2114.     bra    P60_fxdone
  2115.  
  2116. P60_funk2
  2117.     moveq    #0,d0
  2118.     move.b    P60_Funkspd(a5),d0
  2119.     beq.b    P60_funkend
  2120.     move.b    P60_FunkTable(pc,d0),d0
  2121.     add.b    d0,P60_Funkoff(a5)
  2122.     bpl.b    P60_funkend
  2123.     clr.b    P60_Funkoff(a5)
  2124.  
  2125.     move.l    P60_Sample(a5),a1
  2126.     move.l    P60_RepeatOffset(a1),d1
  2127.     move    P60_RepeatLength(a1),d0
  2128.     add.l    d0,d0
  2129.     add.l    d1,d0
  2130.     move.l    P60_Wave(a5),a0
  2131.     addq.l    #1,a0
  2132.     cmp.l    d0,a0
  2133.     blo.b    P60_funkok
  2134.     move.l    d1,a0
  2135. P60_funkok
  2136.     move.l    a0,P60_Wave(a5)
  2137.     not.b    (a0)
  2138. P60_funkend
  2139.     rts
  2140.  
  2141. P60_FunkTable dc.b 0,5,6,7,8,10,11,13,16,19,22,26,32,43,64,128
  2142.     endc
  2143.  
  2144. P60_jtab
  2145.     dc    P60_fxdone-*
  2146.     dc    P60_fxdone-*
  2147.     dc    P60_fxdone-*
  2148.  
  2149.     ifne    P60_tp
  2150.     dc    P60_settoneport-*
  2151.     endc
  2152.     ifeq    P60_tp
  2153.     dc    P60_fxdone-*
  2154.     endc
  2155.  
  2156.     ifne    P60_vib
  2157.     dc    P60_vibrato-*
  2158.     endc
  2159.     ifeq    P60_vib
  2160.     dc    P60_fxdone-*
  2161.     endc
  2162.  
  2163.     ifne    P60_tpvs
  2164.     dc    P60_toponochange-*
  2165.     endc
  2166.     ifeq    P60_tpvs
  2167.     dc    P60_fxdone-*
  2168.     endc
  2169.  
  2170.     dc    P60_fxdone-*
  2171.  
  2172.     ifne    P60_tre
  2173.     dc    P60_settremo-*
  2174.     endc
  2175.     ifeq    P60_tre
  2176.     dc    P60_fxdone-*
  2177.     endc
  2178.  
  2179.     dc    P60_fxdone-*
  2180.  
  2181.     ifne    P60_sof
  2182.     dc    P60_sampleoffse-*
  2183.     endc
  2184.     ifeq    P60_sof
  2185.     dc    P60_fxdone-*
  2186.     endc
  2187.     dc    P60_fxdone-*
  2188.  
  2189.     ifne    P60_pj
  2190.     dc    P60_posjmp-*
  2191.     endc
  2192.     ifeq    P60_pj
  2193.     dc    P60_fxdone-*
  2194.     endc
  2195.  
  2196.     ifne    P60_vl
  2197.     dc    P60_volum-*
  2198.     endc
  2199.     ifeq    P60_vl
  2200.     dc    P60_fxdone-*
  2201.     endc
  2202.  
  2203.     ifne    P60_pb
  2204.     dc    P60_pattbreak-*
  2205.     endc
  2206.     ifeq    P60_pb
  2207.     dc    P60_fxdone-*
  2208.     endc
  2209.  
  2210.     ifne    P60_ec
  2211.     dc    P60_ecommands-*
  2212.     endc
  2213.     ifeq    P60_ec
  2214.     dc    P60_fxdone-*
  2215.     endc
  2216.     
  2217.     ifne    P60_sd
  2218.     dc    P60_cspeed-*
  2219.     endc
  2220.     ifeq    P60_sd
  2221.     dc    P60_fxdone-*
  2222.     endc
  2223.  
  2224.  
  2225. P60_dmason
  2226.     ifeq    system
  2227.     tst.b    $bfdd00
  2228.     move.l    a0,-(sp)
  2229.     move.l    P60_vektori(pc),a0
  2230.     move.l    P60_intaddr(pc),(a0)
  2231.     move.l    (sp)+,a0
  2232.     move    P60_dma(pc),$dff096
  2233.     move    #$2000,$dff09c
  2234.     move.b    #$19,$bfde00
  2235.     rte
  2236.     endc
  2237.  
  2238.     ifne    system
  2239.     move    P60_dma(pc),$96(a6)
  2240.     addq    #1,P60_server-P60_cn(a3)
  2241.     move.l    P60_craddr(pc),a0
  2242.     move.b    #$19,(a0)
  2243.     bra    P60_ohi
  2244.     endc
  2245.  
  2246.  
  2247. P60_setrepeat
  2248.     ifeq    system
  2249.     tst.b    $bfdd00
  2250.     movem.l    a0/a1,-(sp)
  2251.     lea    $dff0a0,a1
  2252.     endc
  2253.     ifne    system
  2254.     lea    $a0(a6),a1
  2255.     endc
  2256.  
  2257.     move.l    P60_Sample+P60_temp0(pc),a0
  2258.     addq.l    #6,a0
  2259.     move.l    (a0)+,(a1)+
  2260.     move    (a0),(a1)
  2261.  
  2262.     ifgt    channels-1
  2263.     move.l    P60_Sample+P60_temp1(pc),a0
  2264.     addq.l    #6,a0
  2265.     move.l    (a0)+,12(a1)
  2266.     move    (a0),16(a1)
  2267.     endc
  2268.     
  2269.     ifgt    channels-2
  2270.     move.l    P60_Sample+P60_temp2(pc),a0
  2271.     addq.l    #6,a0
  2272.     move.l    (a0)+,28(a1)
  2273.     move    (a0),32(a1)
  2274.     endc
  2275.  
  2276.     ifgt    channels-3
  2277.     move.l    P60_Sample+P60_temp3(pc),a0
  2278.     addq.l    #6,a0
  2279.     move.l    (a0)+,44(a1)
  2280.     move    (a0),48(a1)
  2281.     endc
  2282.  
  2283.     ifne    system
  2284.     clr    P60_server-P60_cn(a3)
  2285.     move.l    P60_craddr+4(pc),a0
  2286.     move.b    P60_tlo(pc),(a0)
  2287.     move.b    P60_thi(pc),$100(a0)
  2288.     bra    P60_ohi
  2289.     endc
  2290.  
  2291.     ifeq    system
  2292.     move    #$2000,-8(a1)
  2293.     ifne    CIA
  2294.     move.l    P60_vektori(pc),a0
  2295.     move.l    P60_tintti(pc),(a0)
  2296.     move.b    P60_tlo(pc),$bfd400
  2297.     move.b    P60_thi(pc),$bfd500
  2298.     endc
  2299.  
  2300.     movem.l    (sp)+,a0/a1
  2301.     rte
  2302.     endc
  2303.  
  2304. P60_temp0
  2305.     dcb.b    Channel_Block_SIZE-2
  2306.     dc    1
  2307. P60_temp1
  2308.     dcb.b    Channel_Block_SIZE-2
  2309.     dc    2
  2310. P60_temp2
  2311.     dcb.b    Channel_Block_SIZE-2
  2312.     dc    4
  2313. P60_temp3
  2314.     dcb.b    Channel_Block_SIZE-2
  2315.     dc    8
  2316.  
  2317. P60_cn    dc    0
  2318. P60_dma    dc    $8200
  2319. P60_rowpos
  2320.     dc    0
  2321. P60_speed
  2322.     dc    0
  2323. P60_speed2
  2324.     dc    0
  2325. P60_speedis1
  2326.     dc    0
  2327. P60_spos
  2328.     dc.l    0
  2329.     ifeq    system
  2330. P60_vektori
  2331.     dc.l    0
  2332.     endc
  2333. P60_ofilter
  2334.     dc    0
  2335.     ifne    CIA
  2336. P60_tintti
  2337.     dc.l    0
  2338. P60_thi    dc.b    0
  2339. P60_tlo    dc.b    0
  2340. P60_thi2
  2341.     dc.b    0
  2342. P60_tlo2
  2343.     dc.b    0
  2344. P60_timer
  2345.     dc.l    0
  2346.     endc
  2347.  
  2348.     ifne    P60_pl
  2349. P60_plcount
  2350.     dc    0
  2351. P60_plflag
  2352.     dc    0
  2353. P60_plreset
  2354.     dc    0
  2355. P60_plrowpos
  2356.     dc    0
  2357. P60_looppos
  2358.     dcb.b    12*channels
  2359.     endc
  2360.  
  2361.     ifne    P60_pde
  2362. P60_pdelay
  2363.     dc    0
  2364.     endc
  2365. P60_Samples
  2366.     dcb.b    16*31
  2367. P60_positionbase
  2368.     dc.l    0
  2369. P60_possibase
  2370.     dc.l    0
  2371. P60_patternbase
  2372.     dc.l    0
  2373. P60_intaddr
  2374.     dc.l    0
  2375. P60_oldlev6
  2376.     dc.l    0
  2377.     ifne    system
  2378. P60_server
  2379.     dc    0
  2380. P60_miscbase    dc.l    0
  2381. P60_audioopen    dc.b    0
  2382. P60_sigbit    dc.b    -1
  2383. P60_ciares    dc.l    0
  2384. P60_craddr    dc.l    0,0,0
  2385.  
  2386. P60_dat        dc    $f00
  2387. P60_timerinterrupt
  2388.         dc    0,0,0,0,127
  2389. P60_timerdata    dc.l    0,0,0
  2390.  
  2391. P60_allocport    dc.l    0,0
  2392.         dc.b    4,0
  2393.         dc.l    0
  2394.         dc.b    0,0
  2395.         dc.l    0
  2396. P60_reqlist    dc.l    0,0,0
  2397.         dc.b    5,0
  2398. P60_allocreq    dc.l    0,0
  2399.         dc    127
  2400.         dc.l    0
  2401. P60_portti    dc.l    0
  2402.         dc    68
  2403.         dc.l    0,0,0
  2404.         dc    0
  2405. P60_reqdata    dc.l    0
  2406.         dc.l    1,0,0,0,0,0,0
  2407.         dc    0
  2408. P60_audiodev    dc.b    'audio.device',0
  2409.  
  2410. P60_cianame    dc.b    'ciax.resource',0
  2411. P60_timeropen    dc.b    0
  2412. P60_timerint    dc.b    'P60TimerInterrupt',0
  2413.     endc
  2414. P60_etu
  2415.  
  2416. ******** END OF BINARY FILE **************
  2417.  
  2418.     section    chip,data_c
  2419. P60_data    incbin    "ram:P60.pid.alkumusa.s"
  2420.  
  2421.     section    smp,bss_c
  2422. samples    ;ds.b    $32600        ;uncomment if you have packed samples
  2423.                 ;and insert sample buffer length
  2424.